package br.ufmg.ubicomp.droidguide.context;

import java.util.Calendar;

import br.ufmg.ubicomp.droidguide.common.DroidGuideEntity;
import br.ufmg.ubicomp.droidguide.common.DroidGuideUser;
import br.ufmg.ubicomp.droidguide.common.Location;
import br.ufmg.ubicomp.droidguide.eventservice.enums.EventType;
import br.ufmg.ubicomp.droidguide.eventservice.event.EventSource;
import br.ufmg.ubicomp.droidguide.eventservice.event.UserEvent;
import br.ufmg.ubicomp.droidguide.eventservice.management.EventManager;
import br.ufmg.ubicomp.droidguide.eventservice.management.EventService;


public class Context extends DroidGuideEntity{

	private DroidGuideUser droidGuideUser;
	private Location location;
	private byte hunger;
	private byte mood;
	private byte provision;
	private byte sleep;
	private byte time;

		
	public byte getHunger() {
		return hunger;
	}

	public void setHunger(byte hunger) {
		this.hunger = hunger;
	}

	public byte getMood() {
		return mood;
	}

	public void setMood(byte mood) {
		this.mood = mood;
	}

	public byte getProvision() {
		return provision;
	}

	public void setProvision(byte provision) {
		this.provision = provision;
	}

	public byte getSleep() {
		return sleep;
	}

	public void setSleep(byte sleep) {
		this.sleep = sleep;
	}

	public byte getTime() {
		return time;
	}

	public void setTime(byte time) {
		this.time = time;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
		// creating an event
		UserEvent event = EventManager.getInstance().createEvent(Calendar.getInstance(), 
				EventType.PROFILE, "Location changed", EventSource.LOCATION, location.toString());
	    // handling the event
		EventService.getInstance().handleEvent(event);
	}

	public DroidGuideUser getDroidGuideUser() {
		return droidGuideUser;
	}

	public void setDroidGuideUser(DroidGuideUser droidGuideUser) {
		this.droidGuideUser = droidGuideUser;
	}

	public String getSignature()
	{
		return hunger+","+mood+","+provision+","+sleep+","+time;
	}
}
